# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=ghc-filesystem
pkgver=1.5.14
pkgrel=0
pkgdesc="An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20"
url="https://github.com/gulrak/filesystem"
arch="noarch"
license="MIT"
makedepends="cmake samurai"
checkdepends="catch2"
source="filesystem-$pkgver.tar.gz::https://github.com/gulrak/filesystem/archive/refs/tags/v$pkgver.tar.gz"
builddir=$srcdir/filesystem-$pkgver

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
6eae921485ecdaf4b8329a568b1f4f612ee491fc5fdeafce9c8000b9bf1a73b6fa4e07d0d4ddf05be49efe79e9bddfbcc0aba85529cb016668797a8d89eb9b82  filesystem-1.5.14.tar.gz
"
